﻿using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace ChinaTax.LeQi
{
    public class QueryRedConfirmDetailRequest : Request<QueryRedConfirmDetailResponse>
    {
        public QueryRedConfirmDetailRequest()
        {
            ServiceCode = "CXQDHZQRDMX";
        }

        [JsonProperty("nsrsbh")]
        public string xsfnsrsbh { get => LeQiConfig.TaxNo; }

        [JsonProperty("uuid")]
        public string UUID { get; set; }
    }

    public class QueryRedConfirmDetailResponse : Response
    {
        [JsonProperty("uuid")]
        public string RedUUID { get; set; }

        [JsonProperty("hzfpxxqrdbh")]
        public string RedConfirmNo { get; set; }

        [JsonProperty("lrfsf")]
        public string InputParty { get; set; }

        [JsonProperty("xsfnsrsbh")]
        public string SellerTaxNo { get; set; }

        [JsonProperty("xsfmc")]
        public string SellerName { get; set; }

        [JsonProperty("gmfnsrsbh")]
        public string PurchaserTaxNo { get; set; }

        [JsonProperty("gmfmc")]
        public string PurchaserName { get; set; }

        [JsonProperty("lzfpdm")]
        public string BlueInvoiceCode { get; set; }

        [JsonProperty("lzfphm")]
        public string BlueInvoiceNumber { get; set; }

        [JsonProperty("lzkprq")]
        public string BlueInvoiceDate { get; set; }

        [JsonProperty("lzhjje")]
        public string BlueInvoiceAmount { get; set; }

        [JsonProperty("lzhjse")]
        public string BlueInvoiceTax { get; set; }

        [JsonProperty("lzfppzDm")]
        public string BlueInvoiceType { get; set; }

        [JsonProperty("sfzzfpbz")]
        public string PaperInvoiceFlag { get; set; }

        [JsonProperty("hzcxje")]
        public string RedAmount { get; set; }

        [JsonProperty("hzcxse")]
        public string RedTax { get; set; }

        [JsonProperty("chyyDm")]
        public string RedCause { get; set; }

        [JsonProperty("hzqrxxztDm")]
        public string RedConfirmStatus { get; set; }

        [JsonProperty("qrrq")]
        public string RedConfirmDate { get; set; }

        [JsonProperty("ykjhzfpbz")]
        public string IssuedRedFlag { get; set; }

        [JsonProperty("hzfphm")]
        public string RedInvoiceNumber { get; set; }

        [JsonProperty("hzkprq")]
        public string RedInvoiceDate { get; set; }

        [JsonProperty("yxbz")]
        public string ValidFlag { get; set; }

        [JsonProperty("lrrq")]
        public string InputDate { get; set; }

        [JsonProperty("hzqrxxmxList")]
        public List<RedDetail> Detail { get; set; }
    }

    public class RedDetail
    {
        [JsonProperty("xh")]
        public string Line { get; set; }

        [JsonProperty("lzmxxh")]
        public string BlueInvoiceLine { get; set; }

        [JsonProperty("sphfwssflhbbm")]
        public string TaxClassCode { get; set; }

        [JsonProperty("hwhyslwfwmc")]
        public string Name { get; set; }

        [JsonProperty("spfwjc")]
        public string ShortName { get; set; }

        [JsonProperty("xmmc")]
        public string ItemName { get; set; }

        [JsonProperty("ggxh")]
        public string Specs { get; set; }

        [JsonProperty("dw")]
        public string Unit { get; set; }

        [JsonProperty("fpspdj")]
        public string Price { get; set; }

        [JsonProperty("fpspsl")]
        public string Qty { get; set; }

        [JsonProperty("je")]
        public string Amount { get; set; }

        [JsonProperty("sl1")]
        public string TaxRate { get; set; }

        [JsonProperty("se")]
        public string Tax { get; set; }
    }

}
